package com.kevineric.pokedex;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import android.util.Log;
public class LogTool extends OutputStream {
  private ByteArrayOutputStream bos = new ByteArrayOutputStream();
  private String name;
  
  public LogTool(String name)   {
    this.name = name;
  }
  
  @Override
  public void write(int b) throws IOException {
    if (b == (int)'\n') {
  String s = new String(this.bos.toByteArray());
  Log.e(this.name, s);
  this.bos = new ByteArrayOutputStream();
    } else {
    this.bos.write(b);
    }
  }
}